<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>inputEx - DateField Usage</title>

<!-- YUI CSS -->
<link rel="stylesheet" type="text/css" href="../lib/yui/reset/reset-min.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/fonts/fonts-min.css">
<link rel="stylesheet" type="text/css" href="../lib/yui/container/assets/container.css"> 
<link rel="stylesheet" type="text/css" href="../lib/yui/assets/skins/sam/skin.css">

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../css/inputEx.css' />

<!-- Demo CSS -->
<link rel="stylesheet" type="text/css" href="css/demo.css"/>
<link rel="stylesheet" type="text/css" href="css/dpSyntaxHighlighter.css">

 </head>

 <body>

<p class='demoTitle'>inputEx - DateField Usage</p>


<!-- Example 1 -->
<div class='exampleDiv'>

	<p class="title">Basic DateField creation</p>
	
	<p>Use the following code to create a basic inputEx DateField.</p>

	<div class='demoContainer' id='container1'></div>

	<div class='codeContainer'>
				<textarea name="code" class="JScript">
			new YAHOO.inputEx.DateField({parentEl: 'container1', value: new Date(), showMsg: true});
		</textarea>
			</div>

</div>


<!-- Example 2 -->
<div class='exampleDiv'>

	<p class="title">Change date format</p>
	
	<p>Set the formatDate to your localized date format ! Here is the french format :</p>

	<div class='demoContainer' id='container2'></div>

	<div class='codeContainer'>
				<textarea name="code" class="JScript">
			new YAHOO.inputEx.DateField({dateFormat: 'd/m/Y', value: '03/27/2008', parentEl: 'container2', showMsg: true});
		</textarea>
			</div>

</div>


<!-- Example 3 -->
<div class='exampleDiv'>

	<p class="title">Updated event and return value</p>
	
	<p>The DateField returns a javascript Date object instance :</p>

	<div class='demoContainer' id='container3'></div>

	<div class='codeContainer'>
				<textarea name="code" class="JScript">
			var exampleDiv = YAHOO.util.Dom.get('container3');
			var dateField = new YAHOO.inputEx.DateField({value: new Date(),  parentEl: exampleDiv, showMsg: true, required:true, typeInvite:'m/d/Y'}); 
			dateField.updatedEvt.subscribe(function() {
				exampleDiv.appendChild( inputEx.cn('div', null, null, dateField.getValue()) ); 
			});

			var button1 = inputEx.cn('button', null, null, 'setValue()');
			exampleDiv.appendChild(button1); 
			YAHOO.util.Event.addListener(button1, 'click', function() { dateField.setValue("06/10/1984"); });

			var button2 = inputEx.cn('button', null, null, 'getValue()');
			exampleDiv.appendChild(button2); 
			YAHOO.util.Event.addListener(button2, 'click', function() { alert(dateField.getValue()); });
		</textarea>
			</div>

</div>


<!-- YUI Library -->
<script type="text/javascript" src="../lib/yui/yahoo/yahoo-min.js"></script> 
<script type="text/javascript" src="../lib/yui/dom/dom-min.js"></script> 
<script type="text/javascript" src="../lib/yui/event/event-min.js"></script>
<script type="text/javascript" src="../lib/yui/container/container-min.js"></script>

<!-- InputEx -->
<script src="../js/inputex.js"  type='text/javascript'></script>
<script src="../js/Field.js"  type='text/javascript'></script>
<script src="../js/fields/StringField.js"  type='text/javascript'></script>
<script src="../js/fields/DateField.js"  type='text/javascript'></script>

<script>

YAHOO.util.Event.addListener(window, 'load', function() {

	// Example 1
	new YAHOO.inputEx.DateField({parentEl: 'container1', value: new Date(), showMsg: true});
	
	// Example 2
	new YAHOO.inputEx.DateField({dateFormat: 'd/m/Y', value: '27/03/2008', parentEl: 'container2', showMsg: true});
	
	// Example 3
	var exampleDiv = YAHOO.util.Dom.get('container3');
	var dateField = new YAHOO.inputEx.DateField({value: new Date(),  parentEl: exampleDiv, showMsg: true, required:true, typeInvite:'m/d/Y'}); 
	dateField.updatedEvt.subscribe(function() {
		exampleDiv.appendChild( inputEx.cn('div', null, null, dateField.getValue()) ); 
	});
	
	var button1 = inputEx.cn('button', null, null, 'setValue()');
	exampleDiv.appendChild(button1); 
	YAHOO.util.Event.addListener(button1, 'click', function() { dateField.setValue("06/10/1984"); });
	
	var button2 = inputEx.cn('button', null, null, 'getValue()');
	exampleDiv.appendChild(button2); 
	YAHOO.util.Event.addListener(button2, 'click', function() { alert(dateField.getValue()); });
	
});

</script>

<script src="js/dpSyntaxHighlighter.js"></script>
<script language="javascript"> 
dp.SyntaxHighlighter.HighlightAll('code');
</script>

 </body>
</html>